<template>
  <div class="public-activities-container">
    <h1>公开活动列表</h1>
    
    <div class="activities-list">
      <div v-for="activity in activities" :key="activity.id" class="activity-card">
        <h2>{{ activity.title }}</h2>
        <p>{{ activity.description.substring(0, 100) }}...</p>
        <p><strong>日期:</strong> {{ activity.date }}</p>
        <p><strong>地点:</strong> {{ activity.location }}</p>
        <router-link :to="'/public-activities/' + activity.id">查看详情</router-link>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
    }
  },
  computed: {
    activities() {
      return this.$store.state.globalActivities;
    }
  }
}
</script>

<style scoped>
.public-activities-container {
  padding: 20px;
}

.activities-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.activity-card {
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 15px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  transition: transform 0.2s;
}

.activity-card:hover {
  transform: translateY(-5px);
}

h2 {
  font-size: 1.2em;
  margin-top: 0;
  color: #333;
}

p {
  color: #666;
  line-height: 1.4;
}

a {
  display: inline-block;
  margin-top: 10px;
  color: #42b983;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}
</style>